Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix copying original bytes in dynamic patches #355

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Fix copying original bytes in dynamic patches #355

merged 1 commit into from
Apr 29, 2024

Conversation

aixxe
Copy link
Contributor

@aixxe aixxe commented Apr 28, 2024

Was originally going to make an issue for this but I ended up fixing it in the process. Original text detailing the bug below:


I think I've run into a bug with the output file when using dynamic patches. Here's one I wrote for the INFINITAS launcher:

{
    type: 'dynamic',
    name: 'Bypass Game File Validation',
    tooltip: 'Ignore expected SHA-256 from server, allowing the game to launch with a modified executable',
    patches: [
        {
            off: [0x74, 'XX', 0xB9, 'XX', 'XX', 'XX', 'XX', 0xE8, 'XX', 'XX', 'XX', 'XX', 0x48, 0x8B, 0x7D],
            on: [0xEB, 'XX', 0xB9, 'XX', 'XX', 'XX', 'XX', 0xE8, 'XX', 'XX', 'XX', 'XX', 0x48, 0x8B, 0x7D],
        },
    ],
},

I'm only replacing the first byte, so the rest is just there to make it sufficiently unique. I kept the wildcards in the on patch as XX assuming it would only change the first byte and leave the rest untouched.

After enabling the patch and saving the file, the output was a little different to what I expected.

It seems like the wildcard bytes are getting replaced with 00 instead of the original contents:

WinMergeU_C1xZ5dc1d4

@mon
Copy link
Owner

mon commented Apr 29, 2024

Huh, that's super weird, I would have expected the closure's variables to appropriately shadow the patch variable. I'll take your word for it as being fixed - even if it's a red herring, byte is a much better name for that argument!

@mon mon merged commit 6c701e8 into mon:master Apr 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants